<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/include.jsp"%>
<head>
	<script type="text/javascript" src='<s:url value="/scripts/CustomTreeUI.js" includeParams="none"/>'></script>
	<link rel="stylesheet" type="text/css" href='<s:url value="/scripts/column-tree.css" includeParams="none"/>'/>
<script type="text/javascript">

Ext.onReady(function (){
	var Tree = Ext.tree;
	var loader =  new Tree.TreeLoader({
      			 dataUrl:'<s:url namespace="/systemParameter" action="list!getChildren.action" includeParams="false"/>',
      			 baseParams:{'systemParameter.type':'<s:property value="systemParameter.type"/>'},
      			 baseAttrs:{
                     uiProvider: Ext.tree.ColumnNodeUI
                 } 
    });
	
	var tree = new Tree.ColumnTree({
    el:'tree-div',
    width: '98%',
    height: 280,
    autoScroll:true,
    animate:true,
    enableDD:true,
    containerScroll: true,
    rootVisible:false,
    columns:[{
        header:'参数值',
        width:100,
        dataIndex:'name',
        renderer:function(v,n,a){
        	return v;
        }
    },
    {
        header:'类型',
        width:100,
        dataIndex:'type'
    },
    {
        header:'说明',
        width:100,
        dataIndex:'detail'
    },
    {
        header:'操作',
        width:100,
        dataIndex:'id',
        renderer:function(v,n,a){
    	 return ['<span class="modify">修改</span>','&nbsp;&nbsp;&nbsp;&nbsp;','<span class="delete">删除</span>'].join("");
   		}
    }

    ], 
    loader:loader
    });
// set the root node
var root = new Tree.AsyncTreeNode({
    text: '功能',
    draggable:false,
    id:'-1'
});

	tree.setRootNode(root);
	tree.render();
	root.expand();
	tree.on('click',function(n,e){

		if(e.getTarget('.modify')){
			var s = '<s:url namespace="/systemParameter" action="addOrUpdate!input.action" includeParams="false"/>?systemParameter.id='+n.id;
			location.href=s;
		}else if (e.getTarget('.delete')){
			var s = '<s:url namespace="/systemParameter" action="list!deleteSP.action" includeParams="false"/>?systemParameter.id='+n.id;
			location.href=s;
		}
	});
});

</script>

</head>
<body>

<div class="tleft"></div>
<div class="tright"></div>
<div class="tbg">搜索</div>
<s:form id="funForm" namespace="/systemParameter" action="list">
<table  cellpadding="1" cellspacing="1"  class="tableInput">
	<tr>
		<td class="tableHeader2">参数类型</td>
		<td class="tableHeader3"><s:select name="systemParameter.type" list="types"/></td>
	</tr>
</table>
 <div class="tableHeader4"><s:submit  cssClass="btn_Text2" value="查 询" />
      <input name="Submit9" type="reset" class="btn_Text2" value="重 置" /></div>
 </s:form>
<div class="tleft"></div>
<div class="tright"></div>
<div class="tbg">参数列表</div>
<div id="tree-div"></div>
<div class="tableHeader4">
		<s:form namespace="/functon" action="addOrUpdate!input.action">
						<s:hidden name="function.parent.id"/>
						<input type="submit" class="btn_Text2" value="添加"></input>
					</s:form>
	
    
</div>
		</body>